<!DOCTYPE html>





<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon.ico?v=7.4.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico?v=7.4.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico?v=7.4.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.4.0" color="#222">

<link rel="stylesheet" href="/css/main.css?v=7.4.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.4.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: 'search.json',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="在Python中，安装第三方模块，是通过包管理工具pip完成的。用pip一个一个安装费时费力，还需要考虑兼容性。我们推荐直接使用anaconda，这是一个基于Python的数据处理和科学计算平台，它已经内置了许多非常有用的第三方库，我们装上Anaconda，就相当于把数十个第三方模块自动安装好了，非常简单易用。 anaconda 是一个用于科学计算的Python发行版，支持 Linux, Mac,">
<meta name="keywords" content="python,virtualenv,anaconda">
<meta property="og:type" content="article">
<meta property="og:title" content="python包管理器anaconda介绍安装和使用">
<meta property="og:url" content="https://unix2dos.github.io/p/3c2948a5.html">
<meta property="og:site_name" content="Levon&#39;s Blog">
<meta property="og:description" content="在Python中，安装第三方模块，是通过包管理工具pip完成的。用pip一个一个安装费时费力，还需要考虑兼容性。我们推荐直接使用anaconda，这是一个基于Python的数据处理和科学计算平台，它已经内置了许多非常有用的第三方库，我们装上Anaconda，就相当于把数十个第三方模块自动安装好了，非常简单易用。 anaconda 是一个用于科学计算的Python发行版，支持 Linux, Mac,">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://unix2dos.github.io/p/3c2948a5/1.png">
<meta property="og:image" content="https://unix2dos.github.io/p/3c2948a5/2.png">
<meta property="og:image" content="https://unix2dos.github.io/p/3c2948a5/4.png">
<meta property="og:image" content="https://unix2dos.github.io/p/3c2948a5/3.png">
<meta property="og:updated_time" content="2019-09-27T15:36:51.121Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="python包管理器anaconda介绍安装和使用">
<meta name="twitter:description" content="在Python中，安装第三方模块，是通过包管理工具pip完成的。用pip一个一个安装费时费力，还需要考虑兼容性。我们推荐直接使用anaconda，这是一个基于Python的数据处理和科学计算平台，它已经内置了许多非常有用的第三方库，我们装上Anaconda，就相当于把数十个第三方模块自动安装好了，非常简单易用。 anaconda 是一个用于科学计算的Python发行版，支持 Linux, Mac,">
<meta name="twitter:image" content="https://unix2dos.github.io/p/3c2948a5/1.png">
  <link rel="canonical" href="https://unix2dos.github.io/p/3c2948a5">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>python包管理器anaconda介绍安装和使用 | Levon's Blog</title>
  








  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">
  <div class="container use-motion">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Levon's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <h1 class="site-subtitle" itemprop="description">微信:  L6241425</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>时光</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-categories">
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-tags">
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger">
        
          <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
      </li>
    
  </ul>

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="none"
           placeholder="搜索..." spellcheck="false"
           type="text" id="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
            

          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
      <article itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block post">
    <link itemprop="mainEntityOfPage" href="https://unix2dos.github.io/p/3c2948a5.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Levon">
      <meta itemprop="description" content="Never Give Up">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Levon's Blog">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">python包管理器anaconda介绍安装和使用

          
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-04-16 19:54:47" itemprop="dateCreated datePublished" datetime="2019-04-16T19:54:47+08:00">2019-04-16</time>
            </span>
          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-09-27 23:36:51" itemprop="dateModified" datetime="2019-09-27T23:36:51+08:00">2019-09-27</time>
              </span>
            
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/1-编程语言/" itemprop="url" rel="index"><span itemprop="name">1-编程语言</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/1-编程语言/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a></span>

                
                
              
            </span>
          

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
        
      
      <span class="post-meta-item-text">Disqus：</span>
    
    <a title="disqus" href="/p/3c2948a5.html#comments" itemprop="discussionUrl"><span class="post-comments-count disqus-comment-count" data-disqus-identifier="p/3c2948a5.html" itemprop="commentCount"></span></a>
  </span>
  
  
          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
              
                <span class="post-meta-item-text">本文字数：</span>
              
              <span>4.1k</span>
            </span>
          
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
              
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              
              <span>4 分钟</span>
            </span>
          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>在Python中，安装第三方模块，是通过包管理工具pip完成的。用pip一个一个安装费时费力，还需要考虑兼容性。我们推荐直接使用<a href="https://www.anaconda.com/" target="_blank" rel="noopener">anaconda</a>，这是一个基于Python的数据处理和科学计算平台，它已经内置了许多非常有用的第三方库，我们装上Anaconda，就相当于把数十个第三方模块自动安装好了，非常简单易用。</p>
<p>anaconda 是一个用于科学计算的Python发行版，支持 Linux, Mac, Windows系统，提供了包管理与环境管理的功能，可以很方便地解决多版本python并存、切换以及各种第三方包安装问题。anaconda 利用工具/命令 conda 来进行 package 和 environment 的管理，并且已经包含了Python和相关的配套工具。</p>
<p>这里先解释下conda、anaconda这些概念的差别，详细差别见下节。</p>
<ol>
<li><h5 id="anaconda"><a href="#anaconda" class="headerlink" title="anaconda"></a>anaconda</h5></li>
</ol>
<p>anaconda 则是一个打包的集合，里面预装好了 conda、某个版本的python、众多packages、科学计算工具等等，所以也称为Python的一种发行版。其实还有Miniconda，顾名思义，它只包含最基本的内容——python与conda，以及相关的必须依赖项，对于空间要求严格的用户，Miniconda是一种选择。</p>
<a id="more"></a>

<ol start="2">
<li><h5 id="conda"><a href="#conda" class="headerlink" title="conda"></a>conda</h5></li>
</ol>
<p>conda 可以理解为一个工具，也是一个可执行命令，其核心功能是<code>包管理</code>与<code>环境管理</code>。 包管理与pip的使用类似，环境管理则允许用户方便地安装不同版本的python并可以快速切换。</p>
<p>进入下文之前，说明一下conda的设计理念——<strong>conda将几乎所有的工具、第三方包都当做package对待，甚至包括python和conda自身</strong>！因此，conda打破了包管理与环境管理的约束，能非常方便地安装各种版本python、各种package并方便地切换。</p>
<h3 id="1-anaconda、conda、pip、virtualenv的区别"><a href="#1-anaconda、conda、pip、virtualenv的区别" class="headerlink" title="1. anaconda、conda、pip、virtualenv的区别"></a>1. anaconda、conda、pip、virtualenv的区别</h3><p><strong>1. anaconda</strong></p>
<p>anaconda是一个包含180+的科学包及其依赖项的发行版本。其包含的科学包包括：conda, numpy, scipy, ipython notebook等。</p>
<p><strong>2. conda</strong></p>
<p>conda是包及其依赖项和环境的管理工具。</p>
<ul>
<li>适用语言：Python, R, Ruby, Lua, Scala, Java, JavaScript, C/C++, FORTRAN。</li>
<li>适用平台：Windows, macOS, Linux</li>
<li>用途：快速安装、运行和升级包及其依赖项；在计算机中便捷地创建、保存、加载和切换环境。</li>
</ul>
<p>如果你需要的包要求不同版本的Python，你无需切换到不同的环境，因为conda同样是一个环境管理器。仅需要几条命令，你可以创建一个完全独立的环境来运行不同的Python版本，同时继续在你常规的环境中使用你常用的Python版本。</p>
<ul>
<li>conda为Python项目而创造，但可适用于上述的多种语言。</li>
<li>conda包和环境管理器包含于anaconda的所有版本当中。</li>
</ul>
<p><strong>3. pip</strong></p>
<ul>
<li>pip是用于安装和管理软件包的包管理器。</li>
<li>pip编写语言：Python。</li>
<li>Python中默认安装的版本：</li>
</ul>
<p>Python 2.7.9及后续版本：默认安装，命令为pip<br>Python 3.4及后续版本：默认安装，命令为pip3</p>
<p><strong>4. virtualenv</strong></p>
<p>用于创建一个独立的Python环境的工具。解决问题：</p>
<ol>
<li>当一个程序需要使用Python 2.7版本，而另一个程序需要使用Python 3.6版本，如何同时使用这两个程序？</li>
<li>如果将所有程序都安装在系统下的默认路径，如：/usr/lib/python2.7/site-packages，当不小心升级了本不该升级的程序时，将会对其他的程序造成影响。</li>
<li>如果想要安装程序并在程序运行时对其库或库的版本进行修改，都会导致程序的中断。</li>
<li>在共享主机时，无法在全局site-packages目录中安装包。</li>
</ol>
<p>virtualenv将会为它自己的安装目录创建一个环境，这并不与其他virtualenv环境共享库；同时也可以选择性地不连接已安装的全局库。</p>
<h3 id="2-pip-与-conda-比较"><a href="#2-pip-与-conda-比较" class="headerlink" title="2. pip 与 conda 比较"></a>2. pip 与 conda 比较</h3><ol>
<li><p>依赖项检查</p>
<p>pip：1. 不一定会展示所需其他依赖包。2. 安装包时或许会直接忽略依赖项而安装，仅在结果中提示错误。</p>
<p>conda：1. 列出所需其他依赖包。2. 安装包时自动安装其依赖项。3. 可以便捷地在包的不同版本中自由切换。</p>
</li>
</ol>
<ol start="2">
<li><p>环境管理</p>
<p>pip：维护多个环境难度较大。<br>conda：比较方便地在不同环境之间进行切换，环境管理较为简单。</p>
</li>
</ol>
<ol start="3">
<li><p>对系统自带Python的影响</p>
<p>pip：在系统自带的Python包中 更新/回退版本/卸载 将影响其他程序。<br>conda：不会影响系统自带Python。</p>
</li>
</ol>
<ol start="4">
<li><p>适用语言</p>
<p>pip：仅适用于Python。<br>conda：适用于Python, R, Ruby, Lua, Scala, Java, JavaScript, C/C++, FORTRAN。</p>
</li>
</ol>
<h3 id="3-conda与pip、virtualenv的关系"><a href="#3-conda与pip、virtualenv的关系" class="headerlink" title="3. conda与pip、virtualenv的关系"></a>3. conda与pip、virtualenv的关系</h3><p>conda结合了pip和virtualenv的功能。</p>
<h3 id="4-anaconda的安装和使用"><a href="#4-anaconda的安装和使用" class="headerlink" title="4. anaconda的安装和使用"></a>4. anaconda的安装和使用</h3><p><strong>1. 下载安装anaconda</strong>  </p>
<p>下载链接: <a href="https://www.anaconda.com/distribution/#download-section" target="_blank" rel="noopener">https://www.anaconda.com/distribution/#download-section</a></p>
<p>傻瓜安装后, anaconda会把系统Path中的python指向自己自带的Python，并且Anaconda安装的第三方模块会安装在Anaconda自己的路径下，不影响系统已安装的Python目录。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">which python3</span><br><span class="line">/Users/liuwei/anaconda3/bin/python3</span><br></pre></td></tr></table></figure>

<p>安装成功后在应用程序里打开 <code>Anaconda Navigator</code>，会展示出已经安装好的其他常用应用，如：</p>
<p><img src="/p/3c2948a5/1.png" alt="1"></p>
<ul>
<li><p>Anaconda Navigtor ：用于管理工具包和环境的图形用户界面，后续涉及的众多管理命令也可以在 Navigator 中手工实现。</p>
</li>
<li><p>Jupyter notebook ：基于web的交互式计算环境，可以编辑易于人们阅读的文档，用于展示数据分析的过程。</p>
</li>
<li><p>qtconsole ：一个可执行 IPython 的仿终端图形界面程序，相比 Python Shell 界面，qtconsole 可以直接显示代码生成的图形，实现多行代码输入执行，以及内置许多有用的功能和函数。</p>
</li>
<li><p>spyder ：一个使用Python语言、跨平台的、科学运算集成开发环境。</p>
</li>
</ul>
<p><strong>2. 安装后在终端输入conda 无法识别这个命令:</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">export PATH="$&#123;HOME&#125;/anaconda3/bin:$PATH"</span><br></pre></td></tr></table></figure>

<p><strong>3. 修改conda镜像源:</strong></p>
<p>如不修改conda的镜像源，99.99%会报http链接失败的错误（网友踩坑经验）。</p>
<p>输入以下两条命令来添加清华源：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ </span><br><span class="line">conda config --set show_channel_urls yes</span><br></pre></td></tr></table></figure>

<p>在家目录下会生成<code>.condarc</code>文件, 然后把ssl_verfiy改为false,</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">ssl_verify: true</span><br><span class="line">channels:</span><br><span class="line">  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/</span><br><span class="line">  - defaults</span><br><span class="line">show_channel_urls: true</span><br></pre></td></tr></table></figure>

<p>然后用 conda info 查看当前配置信息，channel URLs 字段内容变为清华即修改成功。</p>
<h3 id="5-anaconda-python环境的创建和切换"><a href="#5-anaconda-python环境的创建和切换" class="headerlink" title="5. anaconda python环境的创建和切换"></a>5. anaconda python环境的创建和切换</h3><ul>
<li><p>可以在<code>anaconda-navigator</code>创建新的环境</p>
<p><img src="/p/3c2948a5/2.png" alt="1"></p>
</li>
</ul>
<p> 也可以命令行创建:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda create -n py27 python=2.7 或 conda create --name py27 python=2.7</span><br></pre></td></tr></table></figure>

<ul>
<li>使用如下命令，查看当前有哪些环境：</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">conda info -e</span><br><span class="line"></span><br><span class="line">WARNING: The conda.compat module is deprecated and will be removed in a future release.</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> conda environments:</span></span><br><span class="line"><span class="meta">#</span><span class="bash"></span></span><br><span class="line">base                  *  /Users/liuwei/anaconda3</span><br><span class="line">py27                     /Users/liuwei/anaconda3/envs/py27</span><br></pre></td></tr></table></figure>

<p>星号表示当前激活的环境。</p>
<ul>
<li>激活py27环境：</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">source activate py27 </span><br><span class="line">或 </span><br><span class="line">conda activate py27</span><br></pre></td></tr></table></figure>

<p>这时候看python, 已经链接到py27了</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">which python</span><br><span class="line"></span><br><span class="line">/Users/liuwei/anaconda3/envs/py27/bin/python</span><br></pre></td></tr></table></figure>

<ul>
<li>退出当前环境</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">conda deactivate </span><br><span class="line">或 </span><br><span class="line">source deactivate</span><br></pre></td></tr></table></figure>

<ul>
<li>查看安装了哪些包</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda list</span><br></pre></td></tr></table></figure>

<p> 以后可以通过<code>anaconda-navigator</code>在指定环境下安装包</p>
<p><img src="/p/3c2948a5/4.png" alt="1"></p>
<h3 id="6-配置pycharm使用anaconda环境"><a href="#6-配置pycharm使用anaconda环境" class="headerlink" title="6. 配置pycharm使用anaconda环境"></a>6. 配置pycharm使用anaconda环境</h3><p>在<code>Project Interpreter</code> 增加 virtualenvs的特定环境下的执行程序</p>
<p><img src="/p/3c2948a5/3.png" alt="1"></p>
<h3 id="7-常用命令总结"><a href="#7-常用命令总结" class="headerlink" title="7. 常用命令总结"></a>7. 常用命令总结</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">conda info -e  <span class="comment"># 查看有哪些环境</span></span><br><span class="line">conda create --name py27 python=2.7 <span class="comment"># 创建一个环境</span></span><br><span class="line">conda env remove --name py37 <span class="comment"># 删除一个环境</span></span><br><span class="line">conda activate py27 <span class="comment"># 激活某个环境</span></span><br><span class="line">conda deactivate  <span class="comment">#退出当前环境</span></span><br><span class="line">conda list <span class="comment"># 查看安装了哪些包</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># conda 里集成 pip, 以防 conda 没有的包, 通过 pip 来安装</span></span><br><span class="line">conda install pip</span><br><span class="line"></span><br><span class="line"><span class="built_in">which</span> pip</span><br><span class="line">/Users/liuwei/anaconda3/bin/pip</span><br><span class="line"></span><br><span class="line">pip install xxx</span><br></pre></td></tr></table></figure>


    </div>

    
    
    
        
      
        <div id="reward-container">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作, 一个耿直的笑脸~</div>
  <button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
        
      
      <div style="display: inline-block">
        <img src="/images/wechatpay.jpg" alt="Levon 微信支付">
        <p>微信支付</p>
      </div>
        
      
      <div style="display: inline-block">
        <img src="/images/alipay.jpg" alt="Levon 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>

      

      <footer class="post-footer">
          
            
          
          <div class="post-tags">
            
              <a href="/tags/python/" rel="tag"># python</a>
            
              <a href="/tags/virtualenv/" rel="tag"># virtualenv</a>
            
              <a href="/tags/anaconda/" rel="tag"># anaconda</a>
            
          </div>
        

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/p/8731aeb9.html" rel="next" title="python隔离环境virtualenv和virtualenvwrapper的使用">
                  <i class="fa fa-chevron-left"></i> python隔离环境virtualenv和virtualenvwrapper的使用
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/p/a0594c46.html" rel="prev" title="pyqt安装使用打包教程">
                  pyqt安装使用打包教程 <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>

  </div>


          </div>
          
    
    
  <div class="comments" id="comments">
    <div id="disqus_thread">
      <noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript>
    </div>
  </div>
  
  

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">
        
        
        
        
      

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-5"><a class="nav-link" href="#anaconda"><span class="nav-number">1.</span> <span class="nav-text">anaconda</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#conda"><span class="nav-number">2.</span> <span class="nav-text">conda</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-anaconda、conda、pip、virtualenv的区别"><span class="nav-number"></span> <span class="nav-text">1. anaconda、conda、pip、virtualenv的区别</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-pip-与-conda-比较"><span class="nav-number"></span> <span class="nav-text">2. pip 与 conda 比较</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-conda与pip、virtualenv的关系"><span class="nav-number"></span> <span class="nav-text">3. conda与pip、virtualenv的关系</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-anaconda的安装和使用"><span class="nav-number"></span> <span class="nav-text">4. anaconda的安装和使用</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-anaconda-python环境的创建和切换"><span class="nav-number"></span> <span class="nav-text">5. anaconda python环境的创建和切换</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-配置pycharm使用anaconda环境"><span class="nav-number"></span> <span class="nav-text">6. 配置pycharm使用anaconda环境</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#7-常用命令总结"><span class="nav-number"></span> <span class="nav-text">7. 常用命令总结</span></a></div>
        
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
      src="/images/avatar.jpg"
      alt="Levon">
  <p class="site-author-name" itemprop="name">Levon</p>
  <div class="site-description" itemprop="description">Never Give Up</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">127</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
          
            <a href="/categories/">
          
        
        <span class="site-state-item-count">34</span>
        <span class="site-state-item-name">分类</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/tags/">
          
        
        <span class="site-state-item-count">76</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://github.com/unix2dos" title="GitHub &rarr; https://github.com/unix2dos" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="mailto:levonfly@gmail.com" title="E-Mail &rarr; mailto:levonfly@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://twitter.com/levonfly" title="Twitter &rarr; https://twitter.com/levonfly" rel="noopener" target="_blank"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://weibo.com/l6241425" title="Weibo &rarr; https://weibo.com/l6241425" rel="noopener" target="_blank"><i class="fa fa-fw fa-weibo"></i>Weibo</a>
      </span>
    
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Levon</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    <span title="站点总字数">507k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">7:41</span>
</div>

        












        
      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js?v=3.1.0"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="/js/utils.js?v=7.4.0"></script><script src="/js/motion.js?v=7.4.0"></script>
<script src="/js/schemes/pisces.js?v=7.4.0"></script>

<script src="/js/next-boot.js?v=7.4.0"></script>



  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>








  <script src="/js/local-search.js?v=7.4.0"></script>














  

  

  

<script>
  function loadCount() {
    var d = document, s = d.createElement('script');
    s.src = 'https://levonfly.disqus.com/count.js';
    s.id = 'dsq-count-scr';
    (d.head || d.body).appendChild(s);
  }
  // defer loading until the whole page loading is completed
  window.addEventListener('load', loadCount, false);
</script>
<script>
  function disqus_config() {
    this.page.url = "https://unix2dos.github.io/p/3c2948a5.html";
    this.page.identifier = "p/3c2948a5.html";
    this.page.title = 'python包管理器anaconda介绍安装和使用';};
  function loadComments() {
    if (window.DISQUS) {
      DISQUS.reset({
        reload: true,
        config: disqus_config
      });
    } else {
      var d = document, s = d.createElement('script');
      s.src = 'https://levonfly.disqus.com/embed.js';
      s.setAttribute('data-timestamp', '' + +new Date());
      (d.head || d.body).appendChild(s);
    }
  }
    window.addEventListener('load', loadComments, false);
  
</script>

</body>
</html>
